<template>
  <a-form :model="loginPassData">
    <a-form-item label="用户名">
      <a-input v-model:value="loginPassData.username" />
    </a-form-item>
    <a-form-item label="密码">
      <a-input-password v-model:value="loginPassData.password" />
    </a-form-item>
    <a-form-item>
      <a-button @click="handleLogin">登录</a-button>
    </a-form-item>
  </a-form>
</template>
<script setup>
import { login } from "../../../services/login";
import { ref } from "vue";
import { useRouter } from "vue-router";
const loginPassData = ref({});
const router = useRouter();
const handleLogin = async () => {
  const token = await login(loginPassData.value);
  debugger;
  localStorage.token = token;
  router.push({ name: "userList" });
};
</script>
<style></style>
